package android.cs2340UDT;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;


public class CreateToDoListScreenActivity extends Activity {
	
	Manager manage = Security.getManager();
	
	EditText name; 
	
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.list_creation);
		
		// gets UI edit text input box
		final EditText name = (EditText) findViewById(R.id.name);
		
		ImageButton backButton = (ImageButton) findViewById(R.id.Back);
		Button newListButton = (Button) findViewById(R.id.newListButton);
		Button mapButton = (Button) findViewById(R.id.Map);
		
		newListButton.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View arg0) {
				// tells manager to create a new list with the input list name
				manage.createNewList(name.getText().toString());
				Security.updateManager(manage);
				//Starting a new Intent
				Intent nextScreen = new Intent(getApplicationContext(), MainScreenActivity.class);
				//Switches over to CreateItemActivity
				startActivity(nextScreen);
			}
		});
		
		backButton.setOnClickListener(new View.OnClickListener() {
			
			
			public void onClick(View v) {
				Intent nextScreen = new Intent(getApplicationContext(), MainScreenActivity.class);
				startActivity(nextScreen);
				
			}
		});
		
		mapButton.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				Intent nextScreen = new Intent(getApplicationContext(), MapScreenActivity.class);
				startActivity(nextScreen);
				
			}
		});
		
		
	}

}
